<!--#include file="../nav/admin_top.php" -->

<?PHP $lmenuindex=1;?>
<!--#include file="../nav_menu/combo_begin.php" -->


 
<div class="menuBg">
	<a class="menuAdd" href="{url::build('admin_combo','gd_add')}">添加固定套餐</a>
  <div style="clear:both"></div>
</div>
<div style="margin:10px auto">
	搜索：
	<select id="publishs" class="textBox" onchange="fnSearchs()">
		<option value="">-- 所有发布状态 --</option>
		<option value="1">发布状态</option>
		<option value="0">暂停状态</option>
	</select>
	<select id="isend" class="textBox" onchange="fnSearchs()">
		<option value="">-- 所有过期状态 --</option>
		<option value="0">未过期</option>
		<option value="1">已过期</option>
	  
	</select>
	
   
	<input type="text" maxlength="12" id="keywords" class="searchs" /> 
	<input type="button"  onclick="fnSearchs()" value="查询"  />  	
</div> 
<div id="grids"></div> 
<script type="text/javascript">
var url_list = '/admin_combo/gd'; 
var url_modify = '/admin_combo/gd_modify'; 
var url_view = '/admin_combo/gd_view'; 
var url_del = '/admin_combo/combo_del'; 


$().ready(function(){
	o2js.build('jquery_cluetip');
	o2js.build('ymprompt'); 
	o2js.build('o2grid');
	showLoading();
	grids = new o2Grid({
		bind:'grids', 
		url:url_list,
		singleSelect:true,
		imgpath:'/misc/vendors/o2js/o2grid/image',
		cols:[
			{index:'id',mapping:'a.id', name:'序号', width:40,sortable:false, func:function(val,row_index,column_name,json,R){
				 return  '<span title="ID：'+json.id+'" >'+((R.page - 1)*R.rowNum + (row_index+1))+'</span>';
			}}, 
			{index:'name',mapping:'a.name', name:'固定套餐名称', width:150
			},
			{index:'price',mapping:'a.price',align:"right", name:'单价', width:80,func:function(val,row_index,column_name,json,R){
					return val;
				}
			}, 
			{index:'edate',mapping:'a.edate', name:'过期时间', width:140,func:function(val,row_index,column_name,json,R){
					return '<span title="从 '+json.bdate+' 至 '+json.edate+' ">'+val+'</span>';
				}
			},  
			{index:'publishs',mapping:'a.publishs', name:'发布状态', width:80,func:function(val,row_index,column_name,json,R){
					var s = '';
					if(val == '1'){ 
						s= '<span class="green">发布</span>';
					}else{
						s= '<span class="red">暂停</span>';
					}
					return s;
			}
			},
			{index:'id',mapping:'a.id', name:'操作'	, width:140,sortable:false,func:function(val,row_index,column_name,json,R){
					return    ' <a href="'+url_view+'&id='+json.id+'" style="color: " rel="'+url_view+'?id='+json.id+'" class="showinfo" >菜品预览</a> '+ ' <a href="'+url_modify+'?id='+json.id+'" style="color: "  ><img src="/misc/images/edit.gif" />  编辑</a> '+ ' <a href="javascript:void(0)" onclick="fnDel('+json.id+')" ><img src="/misc/images/del.gif" /> 删除</a> ';
				}
			}
		],
		endfunc:function(obj){
			$('a.showinfo').cluetip({
				cluetipClass: 'jtip', 
				sticky: true,
				arrows: true, 
				dropShadow: false,
				closePosition: 'title',
				mouseOutClose: true,
				width:350,
				height:400
			}).each(function(){
				$(this).click(function(e){
					stopDefault(e);
				});
			}); 
		}
	});
	fnSearchs();	 
	$('#keywords').keypress(function(e){
		if(e.keyCode==13||e.keyCode==10){
			fnSearchs();
		}
	}); 
	
});   
function fnSearchs(){
	grids.setBaseParams({
		keywords:encodeURIComponent($('#keywords').val()),
		isend:$('#isend').val(),
		publishs:$('#publishs').val()
	}); 
	grids.load(1); 
}
 

/* 删除 */
function fnDel(NId){
	fnConfirm({
		str:'确认删除本行数据?',
		func_true:function(){
			$('button').attr('disabled','disabled');
			$.post(
				url_del,
				{
					idarr:JSON.encode([NId])
				},
				function(e){
					var ok = errorHandler(e);
					if(ok && ok.success=='1'){
						//window.location.reload();
						grids.reload();
					}
					$('button').attr('disabled','');
				}
			);
		}
	}); 
}
</script>
<!--#include file="../nav_menu/combo_end.php" -->
<!--#include file="../nav/admin_bottom.php" -->